Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timeout when replica connect master #1172

Merged
merged 8 commits into from
Dec 12, 2022

Conversation

caipengbo
Copy link
Contributor

Fixed: #1170

src/cluster/replication.cc Outdated Show resolved Hide resolved
src/cluster/replication.cc Outdated Show resolved Hide resolved
@@ -236,18 +237,23 @@ void ReplicationThread::CallbacksStateMachine::Start() {
handlers_.emplace_front(CallbacksStateMachine::WRITE, "auth write", authWriteCB);
}

uint64_t last_connect_timestamp = 0, connect_timeout_ms = 3100;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If connect_timeout_ms is not dynamically updated, it would be better to use constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had thought about using a constant before, but found that it wasn't used elsewhere, so I wrote it as a local variable to make it more intuitive.

@caipengbo
Copy link
Contributor Author

Does CI fail because timeout is too short? @git-hulk

@git-hulk
Copy link
Member

Does CI fail because timeout is too short? @git-hulk

Not sure, maybe connecting with timeout didn't work at all, you can have a test on your side.

@caipengbo
Copy link
Contributor Author

I found some problems with ScopeExit and SockConnect(timeout) @git-hulk @PragmaTwice

Copy link
Member

@PragmaTwice PragmaTwice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Sorry for these mistakes.

Copy link
Member

@tanruixiang tanruixiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@git-hulk
Copy link
Member

Thanks all, merging...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SLAVEOF command may block a long time
4 participants